package fcrpt

class ProductOnlineStatusController {
        def dynamicQueryService
        def productOnlineStatus(){
            def pageCurrent = params.pageCurrent ? Integer.parseInt(params.pageCurrent) : 1
            def pageSize = params.pageSize ? Integer.parseInt(params.pageSize) : 10
            params.startno = (pageSize * (pageCurrent - 1)) + 1
            params.endno = pageSize * pageCurrent
            def tableHeadList=[]
            def productOnlineStatus=[]
            def pageSizeList = [10,20,50,100]
            def totalCount =0
            def productOnlineStatusSumQty=[]
            if(params.EXPORT_CONTENT_NAME=='Excel'){
                params.SYS_QUERY_NAME = 'productOnlineStatus'
                productOnlineStatus = dynamicQueryService.queryForList(params)
                if (productOnlineStatus.size() > 0) {
                    tableHeadList = productOnlineStatus[0].keySet()
                }
                params.SYS_QUERY_NAME = 'productOnlineStatusCount'
                totalCount = dynamicQueryService.queryForList(params)[0].TOTALCOUNT

                params.SYS_QUERY_NAME = 'productOnlineStatusSumQty'
                productOnlineStatusSumQty = dynamicQueryService.queryForList(params)
            }
            print(tableHeadList)
            [startno:params.startno?:'',
             endno:params.endno?:'',
             pageSize:pageSize,
             totalCount: totalCount,
             pageSizeList: pageSizeList,
             tableHeadList:tableHeadList,
             productOnlineStatus:productOnlineStatus,
             productOnlineStatusSumQty:productOnlineStatusSumQty,
             stepDesc:params.stepDesc?:'',
             docId:params.docId?:'',
             lotId:params.lotId?:'',
             tuhao:params.tuhao?:''
            ]
        }
    }

